home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / jcool01.zip / CALENDAR.H < prev    next >
C/C++ Source or Header  |  1992-08-25  |  2KB  |  74 lines

  1. //
  2. // Copyright (C) 1991 Texas Instruments Incorporated.
  3. //
  4. // Permission is granted to any individual or institution to use, copy, modify,
  5. // and distribute this software, provided that this complete copyright and
  6. // permission notice is maintained, intact, in all copies and supporting
  7. // documentation.
  8. //
  9. // Texas Instruments Incorporated provides this software "as is" without
  10. // express or implied warranty.
  11. //
  12. //
  13. // Created: MBN 04/11/89 -- Initial design and implementation
  14. // Updated: DLS 03/22/91 -- New lite version
  15. // Updated: JAM 08/24/92 -- made static array global and moved to .c
  16. // Updated: JAM 08/24/92 -- made #define constants 'const' objects
  17. //
  18. // This file  contains an enum  definitions  for types day_of_week and months.
  19. // It specifies symbolic constants to be used  as day  and month types.   Note
  20. // that C++  does not distinguish between   an enum  type  and an integer,  so
  21. // function arguments of type `day_of_week' and `month'  are really just `int'
  22. // types.  In addition, ASCII string representations for the  days of the week
  23. // and months  are  provided  in English only.   These can  be  indexed by the
  24. // symbolic enums of the appropriate type.
  25. //
  26. // **NOTE**
  27. // No international  string or  symbolic  representations  are   yet provided.
  28. // These should be added later and can be indexed by the country type.
  29. //
  30.  
  31. #ifndef CALENDARH        // If we have not yet defined the CALENDAR type,
  32. #define CALENDARH        // Indicate that type CALENDAR has been included
  33.  
  34. enum day_of_week {                // Define days type
  35.   SUNDAY,
  36.   MONDAY,
  37.   TUESDAY,
  38.   WEDNESDAY,
  39.   THURSDAY,
  40.   FRIDAY,
  41.   SATURDAY 
  42.   };
  43.  
  44. enum months {                    // Define months type
  45.   JANUARY,
  46.   FEBRUARY,
  47.   MARCH,
  48.   APRIL,
  49.   MAY,
  50.   JUNE,
  51.   JULY,
  52.   AUGUST,
  53.   SEPTEMBER,
  54.   OCTOBER,
  55.   NOVEMBER,
  56.   DECEMBER
  57.   };
  58.  
  59. extern const char* const day_names[];        // Define ASCII day names
  60.  
  61. extern const char* const month_names[];    // Define ASCII month names
  62.  
  63. const long SECOND = 1;
  64. const long MINUTE = 60L*SECOND;
  65. const long HOUR = MINUTE*60L;
  66. const long DAY = HOUR*24L;
  67. const long WEEK = DAY*7L;
  68. const long YEAR = WEEK*52L;
  69.  
  70. inline int IS_LEAP_YEAR(int y)
  71.    { return (y % 4) == 0 && (y % 100) != 0 || (y % 400) == 0; }
  72.  
  73. #endif                        // End #ifdef of CALENDARH
  74.